<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"  %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML>
<html>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>FirstStep</title>
<link href="<%=path%>/static/usercss/css/all.css?jejwej33we" rel="stylesheet" type="text/css">
<jsp:include page="/WEB-INF/web/includ/header.jsp"></jsp:include>
<script type="text/javascript" src="<%=path%>/static/js/jquery-3.2.1.js"></script>
<body>

<section>

<div class="wrap">
    <div id="register">
      <div class="logo"><img src="<%=path %>/static/usercss/images/registerlogo.png" width="300" height="50" alt="分类搜索"></div>
      <div class="respont">
        <h1>修改密码</h1>
        <form action="<%=path %>/web/userLogin/changeSec" method="post" id="form">
          <ol>
            <li>
              <input id="mailbox" name="mailbox" type="text" aria-label="输入用户名\邮箱\手机号码" placeholder="输入用户名\邮箱\手机号码">
            </li>
            <li>
              <input id="validatecode" class="verifycode" name="checkCode" type="text">
              <img src="<%=path %>/web/setValidateCode?">
              <span><a href="javascript:void(0);" id="returnValidateCode">更换</a></span>
            </li>
            <li>
              <input class="submit" name="input6" type="submit" value="下一步">
            </li>
          </ol>
        </form>
      </div>
    </div>
  </div>
</div>
</section>
 <jsp:include page="/WEB-INF/web/includ/footer.jsp"></jsp:include>
 
 <script type="text/javascript" src="<%=path%>/static/managecss/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="<%=path%>/static/managecss/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="<%=path%>/static/managecss/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="<%=path%>/static/managecss/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="<%=path%>/static/managecss/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="<%=path%>/static/managecss/lib/jquery.validation/1.14.0/messages_zh.js"></script> 
 <script type="text/javascript">
 var x = false;
 var y = false;
 $(function() {
		$("#returnValidateCode").click(function() {		
				var m = Math.random();
				$(this).parent().prev().attr("src","<%=path %>/web/setValidateCode?id="+m)
			
		});
		
		$("#validatecode").blur(function() {
			
			$.post("<%=path%>/web/userLogin/getCode",
					{},
					function(mes){
						
				var str1 = $(this).val();
				if(str1.toLowerCase() == mes.toLowerCase())
				{
				
					x=true;					
				}
				else{
					
					layer.alert("验证码错误");
					x=false;				
				}	
			}.bind(this))			
		});
		
		$("#mailbox").blur(function() {
			var str = $(this).val();		
			var zZ = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
			var f = zZ.test(str);
		
			if(f){
				var mother = "mailbox";
				$.post("<%=path%>/web/userLogin/isHaveUser",
						{str:str,mother:mother},
						function(mes){
							if(!mes){
								y=false;
								layer.alert("未找到该用户");
							}else{
								y=true;
							}
							
				})
			}else{
				var mother = "name";
				$.post("<%=path%>/web/userLogin/isHaveUser",
						{str:str,mother:mother},
						function(mes){
							if(!mes){
								y=false;
								layer.alert("未找到该用户");
							}else{
								y=true;
							}
				})
			}
			
		})
		
		
		$("#form").submit(function() {
			return x&&y;
		})
		
});
 
 
 </script>
</body>
</html>
